package com.buer.train.business.service.impl;

import com.buer.train.business.dao.TrainingDao;
import com.buer.train.business.domain.TrainingDO;
import com.buer.train.business.service.TrainingService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class TrainingServiceImpl implements TrainingService {
	@Autowired
	private TrainingDao trainingDao;
	
	@Override
	public TrainingDO get(Integer id){
		return trainingDao.get(id);
	}
	
	@Override
	public List<TrainingDO> list(Map<String, Object> map){
		return trainingDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return trainingDao.count(map);
	}
	
	@Override
	public int save(TrainingDO training){
		return trainingDao.save(training);
	}
	
	@Override
	public int update(TrainingDO training){
		return trainingDao.update(training);
	}
	
	@Override
	public int remove(Integer id){
		return trainingDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return trainingDao.batchRemove(ids);
	}

    @Override
    public PageInfo<TrainingDO> getTrainingList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<TrainingDO> list = trainingDao.getTrainingList(map); // 获取数据
        PageInfo<TrainingDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public TrainingDO getOne(Map<String, Object> map){
        return trainingDao.getOne(map);
    }
	
}
